This page last changed on Oct 30, 2006 by [email protected].

The Stream Provider allows the reading and writing of streaming data. Typically, this is used as the interface to Java's System.out and System.in objects for debugging via the System Stream Provider.

A typically use of the System Stream Provider for getting data via System.in is like this:

<mule-descriptor name="test" implementation="org.mule.components.simple.PassThroughComponent">
  <inbound-router>
    <endpoint address="stream://System.in?promptMessage=Enter something: />
  </inbound-router>
</mule-descriptor>

Note that no <connector> definition is required per se: use of the stream endpoint tells Mule to use the SystemStreamConnector. However, if you need to define it explicitly, you can do so like this:

<connector name="SystemStreamConnector" className="org.mule.providers.stream.SystemStreamConnector">
    <properties>
        <property name="promptMessage" value="Enter something: "/>
        <property name="messageDelayTime" value="1000"/>
    </properties>
</connector>

A typically use of the System Stream Provider for sending data to the console via System.out is like this:

<outbound-router>
 <router className="org.mule.routing.outbound.OutboundPassThroughRouter">
  <endpoint address="stream://System.out" transformers="JMSMessageToObject"/>
 </router>
</outbound-router>

In this example, the output is a JMS message which is sent to System.out. The transformer converts the JMS message to something readable.

Stream Connector Properties

The following properties are defined for this connector:

Property Description Default Required Applies to
promptMessage An optional prompt message to ask the user for input   No System.in
messageDelayTime How long to delay before asking for input 3 seconds No System.in
outputMessage An option output message to print before any data   No System.out System.err

Stream Endpoints

System Stream endpoints are defined using this syntax:

stream://[stream name]

"stream name" can be one of:

  1. System.in - input stream
  2. System.out - output stream
  3. System.err - error output stream 

Property Overrides

You can override certain properties when defining a System Stream endpoint to control the way that particular receiver or dispatcher behaves. The properties that can be set on the individual endpoint are promptMessage and outputMessage.

Transformers

There are no built-in transformers for the Stream Provider.

Document generated by Confluence on Nov 27, 2006 10:27